package handler

import (
	"github.com/gin-gonic/gin"
	"choujiang/box_server/service"
	"choujiang/common/consts"
	"choujiang/common/models"
	"choujiang/common/utils"
)

/**
 @description 获取首页的弹窗提示
 */
func GetHomeAlert(c *gin.Context) {
	form := c.Request.Form
	uniqueId := form.Get("uniqueId")
	user := model.GetUserByUniqueId(uniqueId)
	if user == nil {
		utils.Error(consts.ErrUserNotFound, c)
		return
	}
	ret := make(map[string]interface{})
	ret["my_coupon"] = service.GetMyCouponAlert(user)
	ret["soon_coupon"] = service.GetSoonCoupon(0)

	utils.JSON(ret, c)
}
